﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;

namespace aboveXWords.GUI
{
  public class Sentense : List<Word>
  {
    public Sentense(Picture picture)
    {
      m_picture = picture;
    }

    private readonly Picture m_picture;

    public void AddWord(Word word)
    {
      var backgroundBrush = Painter.Colors.SentenseBrush;
      foreach (Letter letter in word.OfType<Letter>())
        letter.BackgroundBrush = backgroundBrush;
      word.First().Arrow.From = Count == 0 ? m_picture : this.Last().Last();
      word.First().Arrow.To = word.First();
      Add(word);
    }
  }
}